<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon', function (Blueprint $table) {
            $table->increments('id');
            $table->string("name",50)->default('')->comment("优惠券名称");
            $table->tinyInteger("type")->default(0)->comment("优惠券类型 1优惠券 2折扣券 3现金券");
            $table->integer("money")->default(0)->comment("优惠金额");
            $table->tinyInteger("expire_type")->default(0)->comment("有效期类型 1按天数算，2按固定时间算");
            $table->smallInteger("expire_days")->default(0)->comment("有效期天数");
            $table->dateTime("start_time")->comment('有效期开始时间');
            $table->dateTime("end_time")->comment('有效期结束时间');
            $table->integer("min_money")->default(0)->comment("限制最低使用金额(分) 0不限");
            $table->tinyInteger("month")->default(0)->comment("最低使用月份");
            $table->integer("get_count")->default(0)->comment("总共领取数量");
            $table->tinyInteger("limit_num")->default(0)->comment("限制单人领取量");
            $table->tinyInteger("limit_channel")->default(0)->comment("限制使用渠道 1全部 2 油卡 3话费 4商城 5 油卡+话费");
            $table->integer("is_deleted")->default(0)->comment("是否删除");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon');
    }
}
